package com.example.heimashop.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;

import com.example.heimashop.base.BaseActivity;
import com.example.heimashop.databinding.ActivitySplashBinding;

/**
 * 启动页
 * 页面1: SplashActivity - 应用启动页
 */
public class SplashActivity extends BaseActivity<ActivitySplashBinding> {

    private static final long SPLASH_DELAY = 2000; // 2秒

    @Override
    protected ActivitySplashBinding getViewBinding() {
        return ActivitySplashBinding.inflate(getLayoutInflater());
    }

    @Override
    protected void initView() {
        // 启动页不需要初始化视图
    }

    @Override
    protected void initData() {
        // 延迟跳转到主页
        new Handler(Looper.getMainLooper()).postDelayed(() -> {
            Intent intent = new Intent(SplashActivity.this, MainActivity.class);
            startActivity(intent);
            finish();
        }, SPLASH_DELAY);
    }

    @Override
    protected void initListener() {
        // 启动页不需要监听器
    }
}
